/**
 * Created by pl on 2016/9/5.
 */
$(function(){
        //console.log(1)
        var arr = [
            [
                "images/page3_img1.jpg",
                "images/page3_img2.jpg",
                "images/page3_img3.jpg",
                "images/page3_img4.jpg",
                "images/page3_img5.jpg",
                "images/page3_img6.jpg",
                "images/page3_img7.jpg",
                "images/page3_img8.jpg",
                "images/page3_img9.jpg"
            ],
            ["images/page3_img7.jpg",
            "images/page3_img6.jpg",
            "images/page3_img5.jpg",
            "images/page3_img4.jpg",
            "images/page3_img3.jpg",
            "images/page3_img2.jpg",
            "images/page3_img1.jpg",
            "images/page3_img8.jpg",
            "images/page3_img9.jpg"],
            [
                "images/page3_img9.jpg",
                "images/page3_img8.jpg",
                "images/page3_img7.jpg",
                "images/page3_img6.jpg",
                "images/page3_img5.jpg",
                "images/page3_img4.jpg",
                "images/page3_img3.jpg",
                "images/page3_img2.jpg",
                "images/page3_img1.jpg"
            ],
            [
                "images/page3_img4.jpg",
                "images/page3_img3.jpg",
                "images/page3_img2.jpg",
                "images/page3_img1.jpg",
                "images/page3_img5.jpg",
                "images/page3_img9.jpg",
                "images/page3_img8.jpg",
                "images/page3_img7.jpg",
                "images/page3_img6.jpg"
            ],
            [
                "images/page3_img2.jpg",
                "images/page3_img3.jpg",
                "images/page3_img1.jpg",
                "images/page3_img6.jpg",
                "images/page3_img4.jpg",
                "images/page3_img8.jpg",
                "images/page3_img9.jpg",
                "images/page3_img7.jpg",
                "images/page3_img5.jpg",
            ],
            [
                "images/page3_img6.jpg",
                "images/page3_img4.jpg",
                "images/page3_img5.jpg",
                "images/page3_img2.jpg",
                "images/page3_img1.jpg",
                "images/page3_img7.jpg",
                "images/page3_img8.jpg",
                "images/page3_img9.jpg",
                "images/page3_img3.jpg",
            ]
        ]
        $(".nav_l>ul>li").click(function(){
            $(this).children("a").addClass("act");
            $(this).siblings("li").children("a").removeClass("act");
            var index = $(this).index();
            $(".img-box").fadeOut(200,function(){
                $(".img-box").children("div").each(function(i){
                    $(this).children("img").attr({src:arr[index][i]})
                })
                $(".img-box").fadeIn(300);
            });
        })
        $(".img-box>div").mouseenter(function(){
            $(this).children("span").stop().fadeIn(100);
        })
        $(".img-box>div").mouseleave(function(){
            $(this).children("span").fadeOut(100);
        })
        var num = 0 ;
        $(".img-box>div").click(function(){
            num = $(this).children("img").attr('src')[16];
            $(".pp_pic").css({"display":"block","top":$(window).scrollTop()+10});
            $(".pp_pic").children("img").attr({src:"images/big_img"+num+".jpg"})
            $(".pp_overplay").css("display","block");
        })
        $(".pp_overplay").click(function(){
            $(".pp_pic").css("display","none");
            $(".pp_overplay").css("display","none");
        })
        $(".a_left").click(function(){
            if(num == 1){
                return;
            }
            num--;
            $(".pp_pic").children("img").fadeOut(200,function(){
                $(".pp_pic").children("img").attr({src:"images/big_img"+num+".jpg"});
                $(".pp_pic").children("img").fadeIn(200);
            });
        })
        $(".a_left").hover(
            function(){
            if(num == 1){
                return;
            }
            $(".a_left>img").css({'display':'block'});
        },
            function(){
                $(".a_left>img").css({'display':'none'});
            }
        )
        $(".a_right").hover(function(){
                if(num == 9){
                    return;
                }
                $(".a_right>img").css({'display':'block'});
            },function(){
                $(".a_right>img").css({'display':'none'});
            }
        )
        $(".a_right").click(function(){
            //console.log(num);
            if(num == 9){
                return;
            }
            num++;
            $(".pp_pic").children("img").fadeOut(200,function(){
                $(".pp_pic").children("img").attr({src:"images/big_img"+num+".jpg"});
                $(".pp_pic").children("img").fadeIn(200);
            });
        })
    }
)